package com.athena.utils
{
	import flash.external.*;
	import com.junkbyte.console.Cc; 
 
	public class QueryString
	{
		private var _queryString:String;
		private var _all:String;
		private var _params:Object;
 
		public function QueryString(url:String='')
		{
			readQueryString(url);
		}
		public function get getQueryString():String
		{
			return _queryString;
		}
		public function get url():String
		{
			return _all;
		}	
 
		private function readQueryString(url:String=''):void
		{
			try
			{
				_all = (url.length > 0) ? url : ExternalInterface.call("window.location.href.toString");
				_queryString = (_all.length > 0 && _all.split("?").length > 0) ? ("?" + _all.split("?")[1]) : "";
			}catch(e:Error){
				Cc.log("Some error occured. ExternalInterface doesn't work in Standalone player.");
			}
		}
	}
}

//
// Call it like so:
//
//var myPath:QueryString = new QueryString("http://www.studiosedition.com/?page=articles");
//trace(myPath.parameters.page);